package com.atguigu.mapreduce.demo.outputformat;

import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

/**
 * @version V1.0
 * @author: guangcheng
 * @date: 2021/11/30 18:14
 * @description:
 */
public class LogReducer extends Reducer<Text, NullWritable, Text, NullWritable> {

    @Override
    protected void reduce(Text key, Iterable<NullWritable> values, Context context) throws IOException, InterruptedException {

        /**
         * 防止丢数据, 有几条写出去几条, 不管是否重复...
         */
        for (NullWritable value : values) {
            context.write(key, NullWritable.get());
        }
    }
}

